package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysWorkLogMeetings;
import com.ruoyi.system.service.ISysWorkLogMeetingsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 运行会议记录Controller
 * 
 * @author ruoyi
 * @date 2023-02-07
 */
@RestController
@RequestMapping("/system/meetings")
public class SysWorkLogMeetingsController extends BaseController
{
    @Autowired
    private ISysWorkLogMeetingsService sysWorkLogMeetingsService;

    /**
     * 查询运行会议记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysWorkLogMeetings sysWorkLogMeetings)
    {
        startPage();
        List<SysWorkLogMeetings> list = sysWorkLogMeetingsService.selectSysWorkLogMeetingsList(sysWorkLogMeetings);
        return getDataTable(list);
    }

    /**
     * 导出运行会议记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:export')")
    @Log(title = "运行会议记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysWorkLogMeetings sysWorkLogMeetings)
    {
        List<SysWorkLogMeetings> list = sysWorkLogMeetingsService.selectSysWorkLogMeetingsList(sysWorkLogMeetings);
        ExcelUtil<SysWorkLogMeetings> util = new ExcelUtil<SysWorkLogMeetings>(SysWorkLogMeetings.class);
        return util.exportExcel(list, "meetings");
    }

    /**
     * 获取运行会议记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysWorkLogMeetingsService.selectSysWorkLogMeetingsById(id));
    }

    /**
     * 新增运行会议记录
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:add')")
    @Log(title = "运行会议记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysWorkLogMeetings sysWorkLogMeetings)
    {
        return toAjax(sysWorkLogMeetingsService.insertSysWorkLogMeetings(sysWorkLogMeetings));
    }

    /**
     * 修改运行会议记录
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:edit')")
    @Log(title = "运行会议记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysWorkLogMeetings sysWorkLogMeetings)
    {
        return toAjax(sysWorkLogMeetingsService.updateSysWorkLogMeetings(sysWorkLogMeetings));
    }

    /**
     * 删除运行会议记录
     */
    @PreAuthorize("@ss.hasPermi('system:meetings:remove')")
    @Log(title = "运行会议记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysWorkLogMeetingsService.deleteSysWorkLogMeetingsByIds(ids));
    }
}
